<?php

class SelfDefined extends FormElement {

	
	/**
	 *	For the new element that can be self defined.
	 * 
	 * @var String
	 */
	private $other;

	/**
	 * Contains the label title
	 *
	 * @var String
	 */
	private $label;
	
	/**
	 * Constructor for the Other class, passes variables to the FormElement constructor.
	 *
	 * @param String $other
	 */
	public function __construct( $name,$label, $other )
	{
		parent::__construct( $name, array() );
		$this->other = $other;
		$this->label = $label;
	}

	/**
	 * @see FormElement::__toString()
	 */
	public function __toString() {
		return '<div class="form other"><label for="' . $this->name . '">' . $this->label . '</label>' . $this->other . ( $this->errorFound ? '<div class="error">' . $this->errorMessage . '</div>' : '' ) . '</div>';
	}
}

